fix(lucide-react): correct client directives in RSC files#4189
Merged
ericfennis merged 3 commits intolucide-icons:nextfrom Mar 23, 2026
Merged
fix(lucide-react): correct client directives in RSC files#4189ericfennis merged 3 commits intolucide-icons:nextfrom
ericfennis merged 3 commits intolucide-icons:nextfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes an invalid React client directive typo in lucide-react source files so Next.js/Turbopack correctly treats them as client modules, preventing server-evaluation failures around createContext. It also adds a regression test to prevent the typo from reappearing.
Changes:
- Replace the incorrect
'use-client';directive with the valid'use client';directive inIcon.tsandcontext.ts. - Add a Vitest regression test that asserts the first line of those files contains the valid directive.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| packages/lucide-react/src/Icon.ts | Fixes the React client directive so the icon module is treated as a client module in RSC environments. |
| packages/lucide-react/src/context.ts | Fixes the React client directive so context creation isn’t evaluated in server/RSC runtime. |
| packages/lucide-react/tests/directives.spec.js | Adds a regression test to ensure the client directive remains correct. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
ericfennis
approved these changes
Mar 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Follow-up to #4175.
packages/lucide-react/src/Icon.tsandpackages/lucide-react/src/context.tscurrently use'use-client';instead of the valid React client directive'use client';.In Next.js / Turbopack, that typo means those modules are not treated as client-only. Because
context.tsinitializescreateContext, importing Lucide icons from an App Router server component can still fail during server evaluation withTypeError: createContext is not a function.This PR:
I verified this locally with:
pnpm --filter lucide-react testpnpm --filter lucide-react buildAfter the build,
packages/lucide-react/dist/esm/Icon.jsandpackages/lucide-react/dist/esm/context.jsboth emit"use client";.This targets
nextbecause the Lucide React v1 work, including the context provider changes from #4175, lives on that branch.Before Submitting